﻿using System;
using System.Data;
using System.Collections.Generic;
using DTcms.Common;

namespace DTcms.BLL
{
    /// <summary>
    /// view_log
    /// </summary>
    public partial class view_log
    {
        private readonly DAL.view_log dal;
        public view_log()
        {
            dal = new DAL.view_log();
        }

        #region 基本方法============================
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            return dal.Exists(id);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.view_log model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.view_log model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            return dal.Delete(id);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.view_log GetModel(int id)
        {
            return dal.GetModel(id);
        }
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }

        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            return dal.GetList(pageSize, pageIndex, strWhere, filedOrder, out recordCount);
        }
        #endregion

        #region 扩展方法============================

        public int AddLog(int type, int user_id, string user_name, int view_id, string view_title, string con, DateTime add_time) {
            Model.view_log model = new Model.view_log();
            model.type = type;
            model.user_id = user_id;
            model.user_name = user_name;
            model.view_id = view_id;
            model.view_title = view_title;
            model.con = con;
            model.add_time = add_time;

            return dal.Add(model);
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int user_id, int xunjia_id)
        {
            return dal.Exists(user_id, xunjia_id);
        }

        #endregion
    }
}
